home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Bank smakow / BankSmakow.air / BankSmakow.swf / scripts / mx / containers / Panel.as < prev    next >
Text File  |  2009-12-16  |  34KB  |  976 lines

  1. package mx.containers
  2. {
  3.    import flash.display.DisplayObject;
  4.    import flash.display.Graphics;
  5.    import flash.events.Event;
  6.    import flash.events.MouseEvent;
  7.    import flash.geom.Rectangle;
  8.    import flash.text.TextLineMetrics;
  9.    import flash.utils.getQualifiedClassName;
  10.    import mx.automation.IAutomationObject;
  11.    import mx.containers.utilityClasses.BoxLayout;
  12.    import mx.containers.utilityClasses.CanvasLayout;
  13.    import mx.containers.utilityClasses.ConstraintColumn;
  14.    import mx.containers.utilityClasses.ConstraintRow;
  15.    import mx.containers.utilityClasses.IConstraintLayout;
  16.    import mx.containers.utilityClasses.Layout;
  17.    import mx.controls.Button;
  18.    import mx.core.Container;
  19.    import mx.core.ContainerLayout;
  20.    import mx.core.EdgeMetrics;
  21.    import mx.core.EventPriority;
  22.    import mx.core.FlexVersion;
  23.    import mx.core.IFlexDisplayObject;
  24.    import mx.core.IFlexModuleFactory;
  25.    import mx.core.IFontContextComponent;
  26.    import mx.core.IUIComponent;
  27.    import mx.core.IUITextField;
  28.    import mx.core.UIComponent;
  29.    import mx.core.UIComponentCachePolicy;
  30.    import mx.core.UITextField;
  31.    import mx.core.UITextFormat;
  32.    import mx.core.mx_internal;
  33.    import mx.effects.EffectManager;
  34.    import mx.events.CloseEvent;
  35.    import mx.events.SandboxMouseEvent;
  36.    import mx.styles.ISimpleStyleClient;
  37.    import mx.styles.IStyleClient;
  38.    import mx.styles.StyleProxy;
  39.    
  40.    use namespace mx_internal;
  41.    
  42.    public class Panel extends Container implements IConstraintLayout, IFontContextComponent
  43.    {
  44.       
  45.       mx_internal static var createAccessibilityImplementation:Function;
  46.       
  47.       private static var _closeButtonStyleFilters:Object = {
  48.          "closeButtonUpSkin":"closeButtonUpSkin",
  49.          "closeButtonOverSkin":"closeButtonOverSkin",
  50.          "closeButtonDownSkin":"closeButtonDownSkin",
  51.          "closeButtonDisabledSkin":"closeButtonDisabledSkin",
  52.          "closeButtonSkin":"closeButtonSkin",
  53.          "repeatDelay":"repeatDelay",
  54.          "repeatInterval":"repeatInterval"
  55.       };
  56.       
  57.       mx_internal static const VERSION:String = "3.5.0.12683";
  58.       
  59.       private static const HEADER_PADDING:Number = 14;
  60.        
  61.       
  62.       private var layoutObject:Layout;
  63.       
  64.       private var _status:String = "";
  65.       
  66.       private var _titleChanged:Boolean = false;
  67.       
  68.       mx_internal var titleBarBackground:IFlexDisplayObject;
  69.       
  70.       private var regX:Number;
  71.       
  72.       private var regY:Number;
  73.       
  74.       private var _layout:String = "vertical";
  75.       
  76.       mx_internal var closeButton:Button;
  77.       
  78.       private var initializing:Boolean = true;
  79.       
  80.       private var _title:String = "";
  81.       
  82.       protected var titleTextField:IUITextField;
  83.       
  84.       private var _statusChanged:Boolean = false;
  85.       
  86.       private var autoSetRoundedCorners:Boolean;
  87.       
  88.       private var _titleIcon:Class;
  89.       
  90.       private var _constraintRows:Array;
  91.       
  92.       protected var controlBar:IUIComponent;
  93.       
  94.       mx_internal var titleIconObject:Object = null;
  95.       
  96.       protected var titleBar:UIComponent;
  97.       
  98.       private var panelViewMetrics:EdgeMetrics;
  99.       
  100.       private var _constraintColumns:Array;
  101.       
  102.       mx_internal var _showCloseButton:Boolean = false;
  103.       
  104.       private var checkedForAutoSetRoundedCorners:Boolean;
  105.       
  106.       private var _titleIconChanged:Boolean = false;
  107.       
  108.       protected var statusTextField:IUITextField;
  109.       
  110.       public function Panel()
  111.       {
  112.          _constraintColumns = [];
  113.          _constraintRows = [];
  114.          super();
  115.          addEventListener("resizeStart",EffectManager.eventHandler,false,EventPriority.EFFECT);
  116.          addEventListener("resizeEnd",EffectManager.eventHandler,false,EventPriority.EFFECT);
  117.          layoutObject = new BoxLayout();
  118.          layoutObject.target = this;
  119.          showInAutomationHierarchy = true;
  120.       }
  121.       
  122.       private function systemManager_mouseUpHandler(param1:MouseEvent) : void
  123.       {
  124.          if(!isNaN(regX))
  125.          {
  126.             stopDragging();
  127.          }
  128.       }
  129.       
  130.       mx_internal function getHeaderHeightProxy() : Number
  131.       {
  132.          return getHeaderHeight();
  133.       }
  134.       
  135.       override public function getChildIndex(param1:DisplayObject) : int
  136.       {
  137.          if(controlBar && param1 == controlBar)
  138.          {
  139.             return numChildren;
  140.          }
  141.          return super.getChildIndex(param1);
  142.       }
  143.       
  144.       mx_internal function get _controlBar() : IUIComponent
  145.       {
  146.          return controlBar;
  147.       }
  148.       
  149.       mx_internal function getTitleBar() : UIComponent
  150.       {
  151.          return titleBar;
  152.       }
  153.       
  154.       [Bindable("layoutChanged")]
  155.       public function get layout() : String
  156.       {
  157.          return _layout;
  158.       }
  159.       
  160.       override protected function createChildren() : void
  161.       {
  162.          var _loc1_:Class = null;
  163.          var _loc2_:IStyleClient = null;
  164.          var _loc3_:ISimpleStyleClient = null;
  165.          super.createChildren();
  166.          if(!titleBar)
  167.          {
  168.             titleBar = new UIComponent();
  169.             titleBar.visible = false;
  170.             titleBar.addEventListener(MouseEvent.MOUSE_DOWN,titleBar_mouseDownHandler);
  171.             rawChildren.addChild(titleBar);
  172.          }
  173.          if(!mx_internal::titleBarBackground)
  174.          {
  175.             _loc1_ = getStyle("titleBackgroundSkin");
  176.             if(_loc1_)
  177.             {
  178.                titleBarBackground = new _loc1_();
  179.                _loc2_ = mx_internal::titleBarBackground as IStyleClient;
  180.                if(_loc2_)
  181.                {
  182.                   _loc2_.setStyle("backgroundImage",undefined);
  183.                }
  184.                _loc3_ = mx_internal::titleBarBackground as ISimpleStyleClient;
  185.                if(_loc3_)
  186.                {
  187.                   _loc3_.styleName = this;
  188.                }
  189.                titleBar.addChild(DisplayObject(mx_internal::titleBarBackground));
  190.             }
  191.          }
  192.          createTitleTextField(-1);
  193.          createStatusTextField(-1);
  194.          if(!mx_internal::closeButton)
  195.          {
  196.             closeButton = new Button();
  197.             mx_internal::closeButton.styleName = new StyleProxy(this,closeButtonStyleFilters);
  198.             mx_internal::closeButton.upSkinName = "closeButtonUpSkin";
  199.             mx_internal::closeButton.overSkinName = "closeButtonOverSkin";
  200.             mx_internal::closeButton.downSkinName = "closeButtonDownSkin";
  201.             mx_internal::closeButton.disabledSkinName = "closeButtonDisabledSkin";
  202.             mx_internal::closeButton.skinName = "closeButtonSkin";
  203.             mx_internal::closeButton.explicitWidth = mx_internal::closeButton.explicitHeight = 16;
  204.             mx_internal::closeButton.focusEnabled = false;
  205.             mx_internal::closeButton.visible = false;
  206.             mx_internal::closeButton.enabled = enabled;
  207.             mx_internal::closeButton.addEventListener(MouseEvent.CLICK,closeButton_clickHandler);
  208.             titleBar.addChild(mx_internal::closeButton);
  209.             mx_internal::closeButton.owner = this;
  210.          }
  211.       }
  212.       
  213.       public function get constraintColumns() : Array
  214.       {
  215.          return _constraintColumns;
  216.       }
  217.       
  218.       override public function set cacheAsBitmap(param1:Boolean) : void
  219.       {
  220.          super.cacheAsBitmap = param1;
  221.          if(cacheAsBitmap && !mx_internal::contentPane && cachePolicy != UIComponentCachePolicy.OFF && getStyle("backgroundColor"))
  222.          {
  223.             createContentPane();
  224.             invalidateDisplayList();
  225.          }
  226.       }
  227.       
  228.       override public function createComponentsFromDescriptors(param1:Boolean = true) : void
  229.       {
  230.          var _loc3_:Object = null;
  231.          super.createComponentsFromDescriptors();
  232.          if(numChildren == 0)
  233.          {
  234.             setControlBar(null);
  235.             return;
  236.          }
  237.          var _loc2_:IUIComponent = IUIComponent(getChildAt(numChildren - 1));
  238.          if(_loc2_ is ControlBar)
  239.          {
  240.             _loc3_ = _loc2_.document;
  241.             if(mx_internal::contentPane)
  242.             {
  243.                mx_internal::contentPane.removeChild(DisplayObject(_loc2_));
  244.             }
  245.             else
  246.             {
  247.                removeChild(DisplayObject(_loc2_));
  248.             }
  249.             _loc2_.document = _loc3_;
  250.             rawChildren.addChild(DisplayObject(_loc2_));
  251.             setControlBar(_loc2_);
  252.          }
  253.          else
  254.          {
  255.             setControlBar(null);
  256.          }
  257.       }
  258.       
  259.       override protected function layoutChrome(param1:Number, param2:Number) : void
  260.       {
  261.          var _loc9_:Number = NaN;
  262.          var _loc10_:Graphics = null;
  263.          var _loc11_:Number = NaN;
  264.          var _loc12_:Number = NaN;
  265.          var _loc13_:Number = NaN;
  266.          var _loc14_:Number = NaN;
  267.          var _loc15_:Number = NaN;
  268.          var _loc16_:Number = NaN;
  269.          var _loc17_:Number = NaN;
  270.          var _loc18_:Number = NaN;
  271.          var _loc19_:Number = NaN;
  272.          var _loc20_:Number = NaN;
  273.          var _loc21_:Number = NaN;
  274.          super.layoutChrome(param1,param2);
  275.          var _loc3_:EdgeMetrics = EdgeMetrics.EMPTY;
  276.          var _loc4_:Number = getStyle("borderThickness");
  277.          if(getQualifiedClassName(mx_internal::border) == "mx.skins.halo::PanelSkin" && getStyle("borderStyle") != "default" && _loc4_)
  278.          {
  279.             _loc3_ = new EdgeMetrics(_loc4_,_loc4_,_loc4_,_loc4_);
  280.          }
  281.          var _loc5_:EdgeMetrics;
  282.          var _loc6_:Number = (_loc5_ = FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0 ? borderMetrics : _loc3_).left;
  283.          var _loc7_:Number = _loc5_.top;
  284.          var _loc8_:Number;
  285.          if((_loc8_ = getHeaderHeight()) > 0 && height >= _loc8_)
  286.          {
  287.             _loc9_ = param1 - _loc5_.left - _loc5_.right;
  288.             showTitleBar(true);
  289.             titleBar.mouseChildren = true;
  290.             titleBar.mouseEnabled = true;
  291.             (_loc10_ = titleBar.graphics).clear();
  292.             _loc10_.beginFill(16777215,0);
  293.             _loc10_.drawRect(0,0,_loc9_,_loc8_);
  294.             _loc10_.endFill();
  295.             _loc10_.lineStyle(0,0,0);
  296.             _loc10_.drawRect(0,0,_loc9_,param2);
  297.             titleBar.move(_loc6_,_loc7_);
  298.             titleBar.setActualSize(_loc9_,_loc8_);
  299.             mx_internal::titleBarBackground.move(0,0);
  300.             IFlexDisplayObject(mx_internal::titleBarBackground).setActualSize(_loc9_,_loc8_);
  301.             mx_internal::closeButton.visible = mx_internal::_showCloseButton;
  302.             if(mx_internal::_showCloseButton)
  303.             {
  304.                mx_internal::closeButton.setActualSize(mx_internal::closeButton.getExplicitOrMeasuredWidth(),mx_internal::closeButton.getExplicitOrMeasuredHeight());
  305.                mx_internal::closeButton.move(param1 - _loc6_ - _loc5_.right - 10 - mx_internal::closeButton.getExplicitOrMeasuredWidth(),(_loc8_ - mx_internal::closeButton.getExplicitOrMeasuredHeight()) / 2);
  306.             }
  307.             _loc11_ = 10;
  308.             _loc12_ = 10;
  309.             if(mx_internal::titleIconObject)
  310.             {
  311.                _loc13_ = mx_internal::titleIconObject.height;
  312.                _loc14_ = (_loc8_ - _loc13_) / 2;
  313.                mx_internal::titleIconObject.move(_loc11_,_loc14_);
  314.                _loc11_ += mx_internal::titleIconObject.width + 4;
  315.             }
  316.             if(FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0)
  317.             {
  318.                _loc13_ = titleTextField.nonZeroTextHeight;
  319.             }
  320.             else
  321.             {
  322.                _loc13_ = titleTextField.getUITextFormat().measureText(titleTextField.text).height;
  323.             }
  324.             _loc14_ = (_loc8_ - _loc13_) / 2;
  325.             _loc15_ = _loc5_.left + _loc5_.right;
  326.             titleTextField.move(_loc11_,_loc14_ - 1);
  327.             titleTextField.setActualSize(Math.max(0,param1 - _loc11_ - _loc12_ - _loc15_),_loc13_ + UITextField.TEXT_HEIGHT_PADDING);
  328.             if(FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0)
  329.             {
  330.                _loc13_ = statusTextField.textHeight;
  331.             }
  332.             else
  333.             {
  334.                _loc13_ = statusTextField.text != "" ? Number(statusTextField.getUITextFormat().measureText(statusTextField.text).height) : Number(0);
  335.             }
  336.             _loc14_ = (_loc8_ - _loc13_) / 2;
  337.             _loc16_ = param1 - _loc12_ - 4 - _loc15_ - statusTextField.textWidth;
  338.             if(mx_internal::_showCloseButton)
  339.             {
  340.                _loc16_ -= mx_internal::closeButton.getExplicitOrMeasuredWidth() + 4;
  341.             }
  342.             statusTextField.move(_loc16_,_loc14_ - 1);
  343.             statusTextField.setActualSize(statusTextField.textWidth + 8,statusTextField.textHeight + UITextField.TEXT_HEIGHT_PADDING);
  344.             _loc17_ = titleTextField.x + titleTextField.textWidth + 8;
  345.             if(statusTextField.x < _loc17_)
  346.             {
  347.                statusTextField.width = Math.max(statusTextField.width - (_loc17_ - statusTextField.x),0);
  348.                statusTextField.x = _loc17_;
  349.             }
  350.          }
  351.          else if(titleBar)
  352.          {
  353.             showTitleBar(false);
  354.             titleBar.mouseChildren = false;
  355.             titleBar.mouseEnabled = false;
  356.          }
  357.          if(controlBar)
  358.          {
  359.             _loc18_ = controlBar.x;
  360.             _loc19_ = controlBar.y;
  361.             _loc20_ = controlBar.width;
  362.             _loc21_ = controlBar.height;
  363.             controlBar.setActualSize(param1 - (_loc5_.left + _loc5_.right),controlBar.getExplicitOrMeasuredHeight());
  364.             controlBar.move(_loc5_.left,param2 - _loc5_.bottom - controlBar.getExplicitOrMeasuredHeight());
  365.             if(controlBar.includeInLayout)
  366.             {
  367.                controlBar.visible = controlBar.y >= _loc5_.top;
  368.             }
  369.             if(_loc18_ != controlBar.x || _loc19_ != controlBar.y || _loc20_ != controlBar.width || _loc21_ != controlBar.height)
  370.             {
  371.                invalidateDisplayList();
  372.             }
  373.          }
  374.       }
  375.       
  376.       public function set layout(param1:String) : void
  377.       {
  378.          if(_layout != param1)
  379.          {
  380.             _layout = param1;
  381.             if(layoutObject)
  382.             {
  383.                layoutObject.target = null;
  384.             }
  385.             if(_layout == ContainerLayout.ABSOLUTE)
  386.             {
  387.                layoutObject = new CanvasLayout();
  388.             }
  389.             else
  390.             {
  391.                layoutObject = new BoxLayout();
  392.                if(_layout == ContainerLayout.VERTICAL)
  393.                {
  394.                   BoxLayout(layoutObject).direction = BoxDirection.VERTICAL;
  395.                }
  396.                else
  397.                {
  398.                   BoxLayout(layoutObject).direction = BoxDirection.HORIZONTAL;
  399.                }
  400.             }
  401.             if(layoutObject)
  402.             {
  403.                layoutObject.target = this;
  404.             }
  405.             invalidateSize();
  406.             invalidateDisplayList();
  407.             dispatchEvent(new Event("layoutChanged"));
  408.          }
  409.       }
  410.       
  411.       public function get constraintRows() : Array
  412.       {
  413.          return _constraintRows;
  414.       }
  415.       
  416.       [Bindable("titleChanged")]
  417.       public function get title() : String
  418.       {
  419.          return _title;
  420.       }
  421.       
  422.       mx_internal function getTitleTextField() : IUITextField
  423.       {
  424.          return titleTextField;
  425.       }
  426.       
  427.       mx_internal function createStatusTextField(param1:int) : void
  428.       {
  429.          var _loc2_:String = null;
  430.          if(titleBar && !statusTextField)
  431.          {
  432.             statusTextField = IUITextField(createInFontContext(UITextField));
  433.             statusTextField.selectable = false;
  434.             if(param1 == -1)
  435.             {
  436.                titleBar.addChild(DisplayObject(statusTextField));
  437.             }
  438.             else
  439.             {
  440.                titleBar.addChildAt(DisplayObject(statusTextField),param1);
  441.             }
  442.             _loc2_ = getStyle("statusStyleName");
  443.             statusTextField.styleName = _loc2_;
  444.             statusTextField.text = status;
  445.             statusTextField.enabled = enabled;
  446.          }
  447.       }
  448.       
  449.       public function get fontContext() : IFlexModuleFactory
  450.       {
  451.          return moduleFactory;
  452.       }
  453.       
  454.       override protected function measure() : void
  455.       {
  456.          var _loc6_:Number = NaN;
  457.          super.measure();
  458.          layoutObject.measure();
  459.          var _loc1_:Rectangle = measureHeaderText();
  460.          var _loc2_:Number = _loc1_.width;
  461.          var _loc3_:Number = _loc1_.height;
  462.          var _loc4_:EdgeMetrics = FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0 ? borderMetrics : EdgeMetrics.EMPTY;
  463.          _loc2_ += _loc4_.left + _loc4_.right;
  464.          var _loc5_:Number = 5;
  465.          _loc2_ += _loc5_ * 2;
  466.          if(mx_internal::titleIconObject)
  467.          {
  468.             _loc2_ += mx_internal::titleIconObject.width;
  469.          }
  470.          if(mx_internal::closeButton)
  471.          {
  472.             _loc2_ += mx_internal::closeButton.getExplicitOrMeasuredWidth() + 6;
  473.          }
  474.          measuredMinWidth = Math.max(_loc2_,measuredMinWidth);
  475.          measuredWidth = Math.max(_loc2_,measuredWidth);
  476.          if(controlBar && controlBar.includeInLayout)
  477.          {
  478.             _loc6_ = controlBar.getExplicitOrMeasuredWidth() + _loc4_.left + _loc4_.right;
  479.             measuredWidth = Math.max(measuredWidth,_loc6_);
  480.          }
  481.       }
  482.       
  483.       mx_internal function getControlBar() : IUIComponent
  484.       {
  485.          return controlBar;
  486.       }
  487.       
  488.       override public function get viewMetrics() : EdgeMetrics
  489.       {
  490.          var _loc2_:EdgeMetrics = null;
  491.          var _loc3_:Number = NaN;
  492.          var _loc4_:Number = NaN;
  493.          var _loc5_:Number = NaN;
  494.          var _loc6_:Number = NaN;
  495.          var _loc7_:Number = NaN;
  496.          var _loc8_:Number = NaN;
  497.          var _loc1_:EdgeMetrics = super.viewMetrics;
  498.          if(FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0)
  499.          {
  500.             if(!panelViewMetrics)
  501.             {
  502.                panelViewMetrics = new EdgeMetrics(0,0,0,0);
  503.             }
  504.             _loc1_ = panelViewMetrics;
  505.             _loc2_ = super.viewMetrics;
  506.             _loc3_ = getStyle("borderThickness");
  507.             _loc4_ = getStyle("borderThicknessLeft");
  508.             _loc5_ = getStyle("borderThicknessTop");
  509.             _loc6_ = getStyle("borderThicknessRight");
  510.             _loc7_ = getStyle("borderThicknessBottom");
  511.             _loc1_.left = _loc2_.left + (!!isNaN(_loc4_) ? _loc3_ : _loc4_);
  512.             _loc1_.top = _loc2_.top + (!!isNaN(_loc5_) ? _loc3_ : _loc5_);
  513.             _loc1_.right = _loc2_.right + (!!isNaN(_loc6_) ? _loc3_ : _loc6_);
  514.             _loc1_.bottom = _loc2_.bottom + (!!isNaN(_loc7_) ? (controlBar && !isNaN(_loc5_) ? _loc5_ : (!!isNaN(_loc4_) ? _loc3_ : _loc4_)) : _loc7_);
  515.             _loc8_ = getHeaderHeight();
  516.             if(!isNaN(_loc8_))
  517.             {
  518.                _loc1_.top += _loc8_;
  519.             }
  520.             if(controlBar && controlBar.includeInLayout)
  521.             {
  522.                _loc1_.bottom += controlBar.getExplicitOrMeasuredHeight();
  523.             }
  524.          }
  525.          return _loc1_;
  526.       }
  527.       
  528.       private function measureHeaderText() : Rectangle
  529.       {
  530.          var _loc3_:UITextFormat = null;
  531.          var _loc4_:TextLineMetrics = null;
  532.          var _loc1_:Number = 20;
  533.          var _loc2_:Number = 14;
  534.          if(titleTextField && titleTextField.text)
  535.          {
  536.             titleTextField.validateNow();
  537.             _loc3_ = titleTextField.getUITextFormat();
  538.             _loc1_ = (_loc4_ = _loc3_.measureText(titleTextField.text,false)).width;
  539.             _loc2_ = _loc4_.height;
  540.          }
  541.          if(statusTextField && statusTextField.text)
  542.          {
  543.             statusTextField.validateNow();
  544.             _loc3_ = statusTextField.getUITextFormat();
  545.             _loc4_ = _loc3_.measureText(statusTextField.text,false);
  546.             _loc1_ = Math.max(_loc1_,_loc4_.width);
  547.             _loc2_ = Math.max(_loc2_,_loc4_.height);
  548.          }
  549.          return new Rectangle(0,0,Math.round(_loc1_),Math.round(_loc2_));
  550.       }
  551.       
  552.       mx_internal function createTitleTextField(param1:int) : void
  553.       {
  554.          var _loc2_:String = null;
  555.          if(!titleTextField)
  556.          {
  557.             titleTextField = IUITextField(createInFontContext(UITextField));
  558.             titleTextField.selectable = false;
  559.             if(param1 == -1)
  560.             {
  561.                titleBar.addChild(DisplayObject(titleTextField));
  562.             }
  563.             else
  564.             {
  565.                titleBar.addChildAt(DisplayObject(titleTextField),param1);
  566.             }
  567.             _loc2_ = getStyle("titleStyleName");
  568.             titleTextField.styleName = _loc2_;
  569.             titleTextField.text = title;
  570.             titleTextField.enabled = enabled;
  571.          }
  572.       }
  573.       
  574.       private function closeButton_clickHandler(param1:MouseEvent) : void
  575.       {
  576.          dispatchEvent(new CloseEvent(CloseEvent.CLOSE));
  577.       }
  578.       
  579.       private function setControlBar(param1:IUIComponent) : void
  580.       {
  581.          if(param1 == controlBar)
  582.          {
  583.             return;
  584.          }
  585.          controlBar = param1;
  586.          if(!checkedForAutoSetRoundedCorners)
  587.          {
  588.             checkedForAutoSetRoundedCorners = true;
  589.             autoSetRoundedCorners = !!styleDeclaration ? styleDeclaration.getStyle("roundedBottomCorners") === undefined : true;
  590.          }
  591.          if(autoSetRoundedCorners)
  592.          {
  593.             setStyle("roundedBottomCorners",controlBar != null);
  594.          }
  595.          var _loc2_:String = getStyle("controlBarStyleName");
  596.          if(_loc2_ && controlBar is ISimpleStyleClient)
  597.          {
  598.             ISimpleStyleClient(controlBar).styleName = _loc2_;
  599.          }
  600.          if(controlBar)
  601.          {
  602.             controlBar.enabled = enabled;
  603.          }
  604.          if(controlBar is IAutomationObject)
  605.          {
  606.             IAutomationObject(controlBar).showInAutomationHierarchy = false;
  607.          }
  608.          invalidateViewMetricsAndPadding();
  609.          invalidateSize();
  610.          invalidateDisplayList();
  611.       }
  612.       
  613.       protected function get closeButtonStyleFilters() : Object
  614.       {
  615.          return _closeButtonStyleFilters;
  616.       }
  617.       
  618.       public function set constraintColumns(param1:Array) : void
  619.       {
  620.          var _loc2_:int = 0;
  621.          var _loc3_:int = 0;
  622.          if(param1 != _constraintColumns)
  623.          {
  624.             _loc2_ = param1.length;
  625.             _loc3_ = 0;
  626.             while(_loc3_ < _loc2_)
  627.             {
  628.                ConstraintColumn(param1[_loc3_]).container = this;
  629.                _loc3_++;
  630.             }
  631.             _constraintColumns = param1;
  632.             invalidateSize();
  633.             invalidateDisplayList();
  634.          }
  635.       }
  636.       
  637.       override public function set enabled(param1:Boolean) : void
  638.       {
  639.          super.enabled = param1;
  640.          if(titleTextField)
  641.          {
  642.             titleTextField.enabled = param1;
  643.          }
  644.          if(statusTextField)
  645.          {
  646.             statusTextField.enabled = param1;
  647.          }
  648.          if(controlBar)
  649.          {
  650.             controlBar.enabled = param1;
  651.          }
  652.          if(mx_internal::closeButton)
  653.          {
  654.             mx_internal::closeButton.enabled = param1;
  655.          }
  656.       }
  657.       
  658.       override public function get baselinePosition() : Number
  659.       {
  660.          if(FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0)
  661.          {
  662.             return super.baselinePosition;
  663.          }
  664.          if(!validateBaselinePosition())
  665.          {
  666.             return NaN;
  667.          }
  668.          return titleBar.y + titleTextField.y + titleTextField.baselinePosition;
  669.       }
  670.       
  671.       protected function stopDragging() : void
  672.       {
  673.          var _loc1_:DisplayObject = systemManager.getSandboxRoot();
  674.          _loc1_.removeEventListener(MouseEvent.MOUSE_MOVE,systemManager_mouseMoveHandler,true);
  675.          _loc1_.removeEventListener(MouseEvent.MOUSE_UP,systemManager_mouseUpHandler,true);
  676.          _loc1_.removeEventListener(SandboxMouseEvent.MOUSE_UP_SOMEWHERE,stage_mouseLeaveHandler);
  677.          regX = NaN;
  678.          regY = NaN;
  679.          systemManager.deployMouseShields(false);
  680.       }
  681.       
  682.       private function titleBar_mouseDownHandler(param1:MouseEvent) : void
  683.       {
  684.          if(param1.target == mx_internal::closeButton)
  685.          {
  686.             return;
  687.          }
  688.          if(enabled && isPopUp && isNaN(regX))
  689.          {
  690.             startDragging(param1);
  691.          }
  692.       }
  693.       
  694.       override mx_internal function get usePadding() : Boolean
  695.       {
  696.          return layout != ContainerLayout.ABSOLUTE;
  697.       }
  698.       
  699.       override protected function initializeAccessibility() : void
  700.       {
  701.          if(Panel.createAccessibilityImplementation != null)
  702.          {
  703.             Panel.createAccessibilityImplementation(this);
  704.          }
  705.       }
  706.       
  707.       protected function getHeaderHeight() : Number
  708.       {
  709.          var _loc1_:Number = getStyle("headerHeight");
  710.          if(isNaN(_loc1_))
  711.          {
  712.             _loc1_ = measureHeaderText().height + HEADER_PADDING;
  713.          }
  714.          return _loc1_;
  715.       }
  716.       
  717.       public function set constraintRows(param1:Array) : void
  718.       {
  719.          var _loc2_:int = 0;
  720.          var _loc3_:int = 0;
  721.          if(param1 != _constraintRows)
  722.          {
  723.             _loc2_ = param1.length;
  724.             _loc3_ = 0;
  725.             while(_loc3_ < _loc2_)
  726.             {
  727.                ConstraintRow(param1[_loc3_]).container = this;
  728.                _loc3_++;
  729.             }
  730.             _constraintRows = param1;
  731.             invalidateSize();
  732.             invalidateDisplayList();
  733.          }
  734.       }
  735.       
  736.       public function set title(param1:String) : void
  737.       {
  738.          _title = param1;
  739.          _titleChanged = true;
  740.          invalidateProperties();
  741.          invalidateSize();
  742.          invalidateViewMetricsAndPadding();
  743.          dispatchEvent(new Event("titleChanged"));
  744.       }
  745.       
  746.       private function showTitleBar(param1:Boolean) : void
  747.       {
  748.          var _loc4_:DisplayObject = null;
  749.          titleBar.visible = param1;
  750.          var _loc2_:int = titleBar.numChildren;
  751.          var _loc3_:int = 0;
  752.          while(_loc3_ < _loc2_)
  753.          {
  754.             (_loc4_ = titleBar.getChildAt(_loc3_)).visible = param1;
  755.             _loc3_++;
  756.          }
  757.       }
  758.       
  759.       override public function styleChanged(param1:String) : void
  760.       {
  761.          var _loc3_:String = null;
  762.          var _loc4_:String = null;
  763.          var _loc5_:String = null;
  764.          var _loc6_:Class = null;
  765.          var _loc7_:IStyleClient = null;
  766.          var _loc8_:ISimpleStyleClient = null;
  767.          var _loc2_:Boolean = !param1 || param1 == "styleName";
  768.          super.styleChanged(param1);
  769.          if(_loc2_ || param1 == "titleStyleName")
  770.          {
  771.             if(titleTextField)
  772.             {
  773.                _loc3_ = getStyle("titleStyleName");
  774.                titleTextField.styleName = _loc3_;
  775.             }
  776.          }
  777.          if(_loc2_ || param1 == "statusStyleName")
  778.          {
  779.             if(statusTextField)
  780.             {
  781.                _loc4_ = getStyle("statusStyleName");
  782.                statusTextField.styleName = _loc4_;
  783.             }
  784.          }
  785.          if(_loc2_ || param1 == "controlBarStyleName")
  786.          {
  787.             if(controlBar && controlBar is ISimpleStyleClient)
  788.             {
  789.                _loc5_ = getStyle("controlBarStyleName");
  790.                ISimpleStyleClient(controlBar).styleName = _loc5_;
  791.             }
  792.          }
  793.          if(_loc2_ || param1 == "titleBackgroundSkin")
  794.          {
  795.             if(titleBar)
  796.             {
  797.                if(_loc6_ = getStyle("titleBackgroundSkin"))
  798.                {
  799.                   if(mx_internal::titleBarBackground)
  800.                   {
  801.                      titleBar.removeChild(DisplayObject(mx_internal::titleBarBackground));
  802.                      titleBarBackground = null;
  803.                   }
  804.                   titleBarBackground = new _loc6_();
  805.                   if(_loc7_ = mx_internal::titleBarBackground as IStyleClient)
  806.                   {
  807.                      _loc7_.setStyle("backgroundImage",undefined);
  808.                   }
  809.                   if(_loc8_ = mx_internal::titleBarBackground as ISimpleStyleClient)
  810.                   {
  811.                      _loc8_.styleName = this;
  812.                   }
  813.                   titleBar.addChildAt(DisplayObject(mx_internal::titleBarBackground),0);
  814.                }
  815.             }
  816.          }
  817.       }
  818.       
  819.       mx_internal function getStatusTextField() : IUITextField
  820.       {
  821.          return statusTextField;
  822.       }
  823.       
  824.       public function set fontContext(param1:IFlexModuleFactory) : void
  825.       {
  826.          this.moduleFactory = param1;
  827.       }
  828.       
  829.       override protected function commitProperties() : void
  830.       {
  831.          var _loc1_:int = 0;
  832.          super.commitProperties();
  833.          if(hasFontContextChanged())
  834.          {
  835.             if(titleTextField)
  836.             {
  837.                _loc1_ = titleBar.getChildIndex(DisplayObject(titleTextField));
  838.                removeTitleTextField();
  839.                createTitleTextField(_loc1_);
  840.                _titleChanged = true;
  841.             }
  842.             if(statusTextField)
  843.             {
  844.                _loc1_ = titleBar.getChildIndex(DisplayObject(statusTextField));
  845.                removeStatusTextField();
  846.                createStatusTextField(_loc1_);
  847.                _statusChanged = true;
  848.             }
  849.          }
  850.          if(_titleChanged)
  851.          {
  852.             _titleChanged = false;
  853.             titleTextField.text = _title;
  854.             if(initialized)
  855.             {
  856.                layoutChrome(unscaledWidth,unscaledHeight);
  857.             }
  858.          }
  859.          if(_titleIconChanged)
  860.          {
  861.             _titleIconChanged = false;
  862.             if(mx_internal::titleIconObject)
  863.             {
  864.                titleBar.removeChild(DisplayObject(mx_internal::titleIconObject));
  865.                titleIconObject = null;
  866.             }
  867.             if(_titleIcon)
  868.             {
  869.                titleIconObject = new _titleIcon();
  870.                titleBar.addChild(DisplayObject(mx_internal::titleIconObject));
  871.             }
  872.             if(initialized)
  873.             {
  874.                layoutChrome(unscaledWidth,unscaledHeight);
  875.             }
  876.          }
  877.          if(_statusChanged)
  878.          {
  879.             _statusChanged = false;
  880.             statusTextField.text = _status;
  881.             if(initialized)
  882.             {
  883.                layoutChrome(unscaledWidth,unscaledHeight);
  884.             }
  885.          }
  886.       }
  887.       
  888.       protected function startDragging(param1:MouseEvent) : void
  889.       {
  890.          regX = param1.stageX - x;
  891.          regY = param1.stageY - y;
  892.          var _loc2_:DisplayObject = systemManager.getSandboxRoot();
  893.          _loc2_.addEventListener(MouseEvent.MOUSE_MOVE,systemManager_mouseMoveHandler,true);
  894.          _loc2_.addEventListener(MouseEvent.MOUSE_UP,systemManager_mouseUpHandler,true);
  895.          _loc2_.addEventListener(SandboxMouseEvent.MOUSE_UP_SOMEWHERE,stage_mouseLeaveHandler);
  896.          systemManager.deployMouseShields(true);
  897.       }
  898.       
  899.       mx_internal function removeStatusTextField() : void
  900.       {
  901.          if(titleBar && statusTextField)
  902.          {
  903.             titleBar.removeChild(DisplayObject(statusTextField));
  904.             statusTextField = null;
  905.          }
  906.       }
  907.       
  908.       private function stage_mouseLeaveHandler(param1:Event) : void
  909.       {
  910.          if(!isNaN(regX))
  911.          {
  912.             stopDragging();
  913.          }
  914.       }
  915.       
  916.       public function set status(param1:String) : void
  917.       {
  918.          _status = param1;
  919.          _statusChanged = true;
  920.          invalidateProperties();
  921.          dispatchEvent(new Event("statusChanged"));
  922.       }
  923.       
  924.       [Bindable("titleIconChanged")]
  925.       public function get titleIcon() : Class
  926.       {
  927.          return _titleIcon;
  928.       }
  929.       
  930.       [Bindable("statusChanged")]
  931.       public function get status() : String
  932.       {
  933.          return _status;
  934.       }
  935.       
  936.       private function systemManager_mouseMoveHandler(param1:MouseEvent) : void
  937.       {
  938.          param1.stopImmediatePropagation();
  939.          if(isNaN(regX) || isNaN(regY))
  940.          {
  941.             return;
  942.          }
  943.          move(param1.stageX - regX,param1.stageY - regY);
  944.       }
  945.       
  946.       override protected function updateDisplayList(param1:Number, param2:Number) : void
  947.       {
  948.          super.updateDisplayList(param1,param2);
  949.          layoutObject.updateDisplayList(param1,param2);
  950.          if(mx_internal::border)
  951.          {
  952.             mx_internal::border.visible = true;
  953.          }
  954.          titleBar.visible = true;
  955.       }
  956.       
  957.       mx_internal function removeTitleTextField() : void
  958.       {
  959.          if(titleBar && titleTextField)
  960.          {
  961.             titleBar.removeChild(DisplayObject(titleTextField));
  962.             titleTextField = null;
  963.          }
  964.       }
  965.       
  966.       public function set titleIcon(param1:Class) : void
  967.       {
  968.          _titleIcon = param1;
  969.          _titleIconChanged = true;
  970.          invalidateProperties();
  971.          invalidateSize();
  972.          dispatchEvent(new Event("titleIconChanged"));
  973.       }
  974.    }
  975. }
  976.